package org.rcgwt.client.ui.validator.impl;

import org.rcgwt.client.ui.validator.ICharacterSets;
import org.rcgwt.client.ui.validator.IClientValidatorContext;
import org.rcgwt.client.ui.validator.IFilter;
import org.rcgwt.client.ui.validator.ISingleton;
import org.rcgwt.client.ui.validator.IValidatorElement;

/**
 * A French Alphabetic filter
 * 
 * @author Elian ORIOU
 * 
 */

public class AlphaDigit_frFilter implements IFilter, ISingleton {

	private static final AlphaDigit_frFilter INSTANCE = new AlphaDigit_frFilter();

	private static final String MY_PATTERN = ICharacterSets.ALPHA_SET
			+ ICharacterSets.NUM_SET + ICharacterSets.PUNCTUATION_SET
			+ ICharacterSets.ACCENT_SET;

	protected AlphaDigit_frFilter() {

	}

	@Override
	public boolean filter(IClientValidatorContext context, char c) {
		// A non digit character
		if (MY_PATTERN.indexOf(c) != -1) {
			return true;
		}
		return false;
	}

	public static IValidatorElement getInstance() {
		return INSTANCE;
	}

}
